package net.alteiar.images.filter.elements;

import java.awt.Graphics2D;
import java.awt.Point;

import net.alteiar.images.BasicImage;
import net.alteiar.images.metadata.EntityInfo;

public class ElementFilterFixed extends ElementFilter {

	public ElementFilterFixed(EntityInfo entity, BasicImage img) {
		super(entity, img);
	}

	@Override
	public void draw(Graphics2D g2, double zoomFactor) {
		int squareSize = 30;// info.getSquareSize();

		Point center = entity.getCenter();
		int width = entity.getWidth();
		int height = entity.getHeight();

		int x = (int) (Math.floor(center.x / squareSize) * squareSize
				* zoomFactor + 1);
		int y = (int) (Math.floor((center.y / squareSize)) * squareSize
				* zoomFactor + 1);

		int realWidth = (int) (width * zoomFactor);
		int realHeight = (int) (height * zoomFactor);

		printElement(g2, new Point(x, y), realWidth, realHeight);
	}
}
